package com.qianyu.project.web.controller.smj;

import com.qianyu.project.entity.ApplyProgressPayment;
import com.qianyu.project.entity.LaborContract;
import com.qianyu.project.service.smj.smjApplyService;
import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("smj_apply")
public class smjApplyController {
    @Autowired
    private smjApplyService as;

    @GetMapping("")
    public String AddApply(String apply_date,String p_id,String ctr_id,String company_id,String payment_name,String contract_amount,String penalty,String withhold,String settle_type,String agree_amount,String agree_upper,String handler_id,String update_user,String settle_comment,String attach_ids){
       return as.AddApply(apply_date,p_id, ctr_id, company_id, payment_name, contract_amount, penalty, withhold, settle_type, agree_amount, agree_upper, handler_id, update_user, settle_comment, attach_ids);
    }

    @GetMapping("/work_list")
    public void worklist(String apply_id,String work_content,String work_count,String unit,String unit_price,String snumber,String hnumber,String comment){
         as.worklist( apply_id, work_content, work_count, unit, unit_price, snumber, hnumber, comment);
    }

    @PostMapping("Flow_apply")
    public Integer FlowApply(@RequestBody ApplyProgressPayment applyProgressPayment){
        return  as.FlowApply(applyProgressPayment);
    }

    @GetMapping("/listApply")
    public Result listApply(@RequestParam Map<String,String> params){
        Map<String, Object> map =new HashMap<>();
        //查询所有项目类型
        //查询所有项目
        map.put("data", as.listApply(params));
        return ResultTool.success(map);
    }

    @GetMapping("/getWorkList")
    public List<Map<String ,Object>> getWorkList(String id){
       return  as.getWorkList(id);
    }

    @GetMapping("/getfromaudit")
    public List<Map<String ,Object>> getfromaudit(String id){
        return  as.getfromaudit(id);
    }
}
